<?php
namespace app\common\controller;
use think\facade\View;
use think\facade\Cache;
use think\facade\Db;
use app\common\variable\MsgCode;
use app\common\model\ArticleCate as ArticleCateModel;
/**
 * 
 */
class ArticleCate extends Base
{
    public static function getSelect($alias,$type='')
    {
    	$where=[];
    	switch ($type) {
    		case 'pc':
    			$where=['pc_show'=>1];
    			break;
    		case 'app':
    			$where=['app_show'=>1];
    			break;
    		case 'h5':
    			$where=['h5_show'=>1];
    			break;
    		case 'mp':
    			$where=['mp_show'=>1];
    			break;
            case 'alipay':
                $where=['alipay_show'=>1];
                break;
            case 'baidu':
                $where=['baidu_show'=>1];
                break;
            case 'toutiao':
                $where=['toutiao_show'=>1];
                break;
            case 'kuaishou':
                $where=['kuaishou_show'=>1];
                break;
    	}
        $ArticleCateModel=ArticleCateModel::where(['alias'=>$alias])->find();
        if ($ArticleCateModel) {
            return ArticleCateModel::where(['pid'=>$ArticleCateModel->id])->where($where)->whereNotNull('alias')->order('sort asc,id asc')->field('title,alias')->select();
        }else{
            return [];
        }
    }
}